package m.jclecai.com.pop;

import android.content.Context;
import android.view.View;
import android.widget.RadioGroup;

import m.jclecai.com.R;

/**
 * Created by ZD on 2017/4/26.
 */

public class MyTrendPopUpWindow extends BasePopupWindow {

    public MyTrendPopUpWindow(Context context,int defCheck,boolean hasHot) {
        super(context);
        setContentView(R.layout.popup_trend);
        RadioGroup rg = findViewById(R.id.rgCheck);
        if(!hasHot) {
            findViewById(R.id.rb_lr).setVisibility(View.GONE);
            findViewById(R.id.split).setVisibility(View.GONE);
        }
        rg.check(defCheck);
        rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                listener.check(group,checkedId);
            }
        });
    }

    @Override
    protected boolean allowBackgroundTranslucent() {
        return false;
    }

    @Override
    protected int setPopWindowAnimationStyle() {
        return -1;
    }

    public interface OnCheckListener{
        void check(RadioGroup group, int ids);
    }
    OnCheckListener listener;
    public void setListener(OnCheckListener listener){
        this.listener = listener;
    }
}
